<?php
/**
 * TweetMVC (Each component fits in a Tweet!)
 * @author	Jeremy Lindblom
 */

// Debug Settings and Functions
require'debug.php';

// Configuration and Error Handling
require'config.php';function c($k){global$config;return@$config[$k]?:NULL;}function e($k=0){$e=c('err');die(@$e[$k]);}

// Model
class M{static function factory($c,$i=0){$m=(@include_once"m/$c.php")?new$c:e(2);return(!$r=$m->load($c,$i))?$m:$r;}function load($c,$i){}}

// View
class V{function V($f){$this->f=$f;}function __toString(){ob_start();extract((array)$this);return(@include"v/$f.php")?ob_get_clean():e(2);}}

// Controller
class C{function __construct($m,$a){call_user_func_array(is_callable($f=array($this,$m?:c('da')))?$f:e(1),$a?explode('/',$a):array());}}

// Library Loader and Front Dispatcher
foreach(c('mod')as$f)require"t/$f.php";@list($c,$m,$a)=explode('/',@$_GET[r],3);$c=$c?:c('dc');$o=(@include"c/$c.php")?@new$c($m,$a):e(1);